package com.study.zgw.proxy;

import lombok.extern.slf4j.Slf4j;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

@Slf4j
public class CalculatorInvocationHandler implements InvocationHandler {
    private Object target;
    public CalculatorInvocationHandler(Object target) {
        this.target = target;
    }
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        log.info("Before method call");
        Object result = method.invoke(target, args);
        log.info("After method call");
        return result;
    }
}
